home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / ultqsrc.zip / MAGIC.QC < prev    next >
Text File  |  1996-10-03  |  38KB  |  1,047 lines

  1. /* MAGIC by Mike Gummelt */
  2. void() cast_touch;
  3. void() SelfCast;
  4. void() TeleEyes;
  5. void() CastLightning;
  6. void(vector dir,float dist,entity cont,entity targ) ShalMissile2;
  7. void()monster_shalrath;
  8. void()monster_demon1;
  9. void() monster_ogre;
  10. void() monster_shambler;
  11. void() monster_wizard;
  12. void() monster_dog;
  13.  
  14. void () PrintSpellName =
  15. {
  16. local string printnum;
  17. //Level 1
  18.         if (self.spell == 24)
  19.                 sprint(self,"HEAL LIGHT WOUNDS\n");
  20.         else if (self.spell == 28)
  21.                 sprint(self,"IRONSKIN\n");
  22.         else if (self.spell == 32)
  23.                 sprint(self,"RESIST FIRE\n");
  24.         else if (self.spell == 36)
  25.                 sprint(self,"ILLUMINATION\n");
  26.         else if (self.spell == 40)
  27.                 sprint(self,"FLESH TO STONE (animal)\n");
  28. //Level 2
  29.         else if (self.spell == 44)
  30.                 sprint(self,"DISPEL MAGIC (self)\n");
  31.         else if (self.spell == 48)
  32.                 sprint(self,"SUMMON SCRAGS\n");
  33.         else if (self.spell == 52)
  34.                 sprint(self,"PROTECT AGAINST EXPLOSIONS\n");
  35.         else if (self.spell == 56)
  36.                 sprint(self,"CHARM ANIMAL\n");
  37.         else if (self.spell == 60)
  38.                 sprint(self,"FLESH TO STONE (person)\n");
  39. //Level 3
  40.         else if (self.spell == 64)
  41.                 sprint(self,"HEAL SERIOUS WOUNDS\n");
  42.         else if (self.spell == 68)
  43.                 sprint(self,"LEVITATION\n");
  44.         else if (self.spell == 72)
  45.                 sprint(self,"DOPPLEGANGER\n");
  46.         else if (self.spell == 76)
  47.                 sprint(self,"GIVE LIFEFORCE (target)\n");
  48.         else if (self.spell == 80)
  49.                 sprint(self,"REFLECTIVE SHIELD (target)\n");
  50. //Level 4
  51.         else if (self.spell == 84)
  52.                 sprint(self,"SPELL OF SHADOWS\n");
  53.         else if (self.spell == 88)
  54.                 sprint(self,"UNLOCK DOOR\n");
  55.         else if (self.spell == 92)
  56.                 sprint(self,"QUAD DAMAGE\n");
  57.         else if (self.spell == 96)
  58.                 sprint(self,"MIND SHOVE\n");
  59.         else if (self.spell == 100)
  60.                 sprint(self,"IRRESISTABLE ATTRACTION\n");
  61. //Level 5
  62.         else if (self.spell == 104)
  63.                 sprint(self,"AMPHIBIAN\n");
  64.         else if (self.spell == 108)
  65.                 sprint(self,"SUMMON OGRE\n");
  66.         else if (self.spell == 112)
  67.                 sprint(self,"DOG'S DAY (target)\n");
  68.         else if (self.spell == 116)
  69.                 sprint(self,"CHARM PERSON\n");
  70.         else if (self.spell == 120)
  71.                 sprint(self,"INCREASE MASS\n");
  72. //Level 6
  73.         else if (self.spell == 124)
  74.                 sprint(self,"HEAL GRIEVEOUS WOUNDS\n");
  75.         else if (self.spell == 128)
  76.                 sprint(self,"REFLECTIVE SHIELD (self)\n");
  77.         else if (self.spell == 132)
  78.                 sprint(self,"PROTECTION FROM MAGIC\n");
  79.         else if (self.spell == 136)
  80.                 sprint(self,"FISH OUT OF WATER\n");
  81.         else if (self.spell == 140)
  82.                 sprint(self,"FLESH TO STONE (monster)\n");
  83. //Level 7
  84.         else if (self.spell == 144)
  85.                 sprint(self,"TELE-EYES\n");
  86.         else if (self.spell == 148)
  87.                 sprint(self,"SUMMON FIEND\n");
  88.         else if (self.spell == 152)
  89.                 sprint(self,"INVISIBLE DEATH BARRIER\n");
  90.         else if (self.spell == 156)
  91.                 sprint(self,"FEEBLEMIND\n");
  92.         else if (self.spell == 160)
  93.                 sprint(self,"CHARM MONSTER\n");
  94. //Level 8
  95.         else if (self.spell == 164)
  96.                 sprint(self,"SUMMON VORE\n");
  97.         else if (self.spell == 168)
  98.                 sprint(self,"MEDUSA'S GAZE\n");
  99.         else if (self.spell == 172)
  100.                 sprint(self,"PATH OF THE ARCHVILE\n");
  101.         else if (self.spell == 176)
  102.                 sprint(self,"SUFFOCATION\n");
  103.         else if (self.spell == 180)
  104.                 sprint(self,"WRATH OF THE ARCHVILE\n");
  105. //Level 9
  106.         else if (self.spell == 184)
  107.                 sprint(self,"SUMMON SHAMBLER\n");
  108.         else if (self.spell == 188)
  109.                 sprint(self,"POWER WORD, KILL\n");
  110.         else if (self.spell == 192)
  111.                 sprint(self,"MASS CHARM\n");
  112.         else if (self.spell == 196)
  113.                 sprint(self,"METEOR SWARM\n");
  114.         else if (self.spell == 200)
  115.                 sprint(self,"LIGHTNING SUMMONING\n");
  116.         sprint (self,"Level: ");
  117.         printnum =ftos(self.splevel);
  118.         sprint(self,printnum);
  119.         sprint (self," Spell: ");
  120.         printnum = ftos((self.spell - self.splevel * 20)/4);
  121.         sprint(self,printnum);
  122.         sprint (self,"\n");
  123.         sprint(self,"Mana Needed: ");
  124.         if(self.spell==48)
  125.                 printnum="80";
  126.         else if(self.spell==108)
  127.                 printnum="200";
  128.         else if(self.spell==148)
  129.                 printnum="300";
  130.         else if(self.spell==164)
  131.                 printnum="400";
  132.         else if(self.spell==184)
  133.                 printnum="600";
  134.         else printnum = ftos(self.spell);
  135.         sprint(self,printnum);
  136.         sprint(self," Your Mana: ");
  137.         self.mana = rint(time - self.init_mana);
  138.         if (self.mana > self.exp/1000)
  139.                 self.mana = self.exp/1000;
  140.         printnum=ftos(self.mana);
  141.         sprint(self,printnum);
  142.         sprint(self,"\n");
  143.         sprint(self,"Experience points: ");
  144.         printnum=ftos(rint(self.exp));
  145.         sprint(self,printnum);
  146.         sprint(self,"\n");
  147.         return;
  148. };
  149.  
  150. void (float way) CycleSpell =
  151. {
  152.         self.spell = (self.spell - self.splevel * 20)/4;
  153.         self.spell = self.spell + way;
  154.         if (self.spell > 5)
  155.                 {
  156.                 self.spell = 1;
  157.                 self.splevel = self.splevel + 1;
  158.                 }
  159.         else if (self.spell < 1)
  160.                 {
  161.                 self.spell = 5;
  162.                 self.splevel = self.splevel - 1;
  163.                 }
  164.         if (self.splevel <= 0)
  165.                 self.splevel = 9;
  166.         else if (self.splevel == 10)
  167.                 self.splevel = 1;
  168.         self.spell = self.splevel * 20 + self.spell * 4;
  169.         PrintSpellName();
  170.         return;
  171. };
  172.  
  173. void(entity spot) MagicEffect =
  174. {
  175.         spawn_tfog (spot.origin);
  176.         sound(spot,CHAN_VOICE,"misc/r_tele5.wav",1,ATTN_NORM);
  177.         return;
  178. };
  179. void() bright =
  180. {
  181.         local vector    vel;
  182.         self.effects=6;
  183.     self.think = flare_dim;
  184.         self.nextthink = time + 15;
  185.     sound (self, CHAN_WEAPON, "misc/power.wav", 1, ATTN_NORM);
  186.     vel = '0 0 150';
  187.     particle (self.origin+vel*0.01,vel,111,150);
  188.         vel = '0 0 120';
  189.     particle (self.origin+vel*0.01,vel,73,200);
  190. };
  191.  
  192. void()sparkle=
  193. {
  194. particle(self.origin,'0 0 0',crandom()*255,random()*7+3);
  195. self.think = sparkle;
  196. self.nextthink = time+0.01;
  197. };
  198. void () Cast =
  199. {
  200.         sound(self,CHAN_VOICE,"misc/r_tele4.wav",1,ATTN_NORM);
  201.         if (((self.spell - (self.splevel*20)) /4 < 4) && self.spell != 88&&self.spell!=112)
  202.                 SelfCast();
  203.         else
  204.         {
  205.  
  206.         if (self.spell == 56 && self.charmed >= 10)
  207.         {
  208.                 sprint(self,"You can't control more than ten monsters at a time\n");
  209.                 return;
  210.         }
  211.         self.alivetime = time + self.spell/20;
  212.         self.mana = rint(time - self.init_mana);
  213.         if (self.mana > self.exp/1000)
  214.                 self.mana = self.exp/1000;
  215.         self.init_mana = time - self.mana + self.spell;
  216.  
  217.         if (self.spell == 196)
  218.                 {
  219.                 FireBall(2,'0 0 0');
  220.                 FireBall(2,'0 0 16');
  221.                 FireBall(2,'0 0 -16');
  222.                 FireBall(2,'0 16 0');
  223.                 FireBall(2,'0 -16 0');
  224.                 return;
  225.                 }
  226. local   entity  missile;
  227.  
  228.     missile = spawn ();
  229.         missile.owner = self;
  230.         missile.movetype = MOVETYPE_FLYMISSILE;
  231.         missile.solid = SOLID_BBOX;
  232.         missile.classname = "spell";
  233.         if (self.spell == 200)
  234.                 missile.aflag = 33;
  235.         else if (self.spell == 88)
  236.                 missile.classname = "magickey";
  237.     makevectors (self.v_angle);
  238.     missile.velocity = aim(self, 1000);
  239.     missile.velocity = missile.velocity * 1000;
  240.     missile.angles = vectoangles(missile.velocity);
  241.         missile.spell = self.spell;
  242.         missile.effects=8;
  243.  
  244.         if(self.spell==36)
  245.                 {
  246.                 missile.touch = flare_touch;
  247.                 missile.think = bright;
  248.                 missile.nextthink = time + 2;
  249.                 missile.classname = "flare";
  250.                 }
  251.         else
  252.                 {
  253.                 missile.think = sparkle;
  254.                 missile.touch = cast_touch;
  255.                 missile.nextthink = time;
  256.                 }
  257.  
  258.         setmodel (missile, "progs/null.spr");
  259.         setsize (missile, '0 0 0', '0 0 0');
  260.     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
  261.         }
  262. };
  263. void (entity loser,float potent, entity printo) HoldWeak =
  264. {
  265. local string printnum;
  266.         if (loser.active == -1 || (!loser.alive)||(loser.skin==1&&loser.classname!="player"))
  267.                 return;
  268.         if (loser.health > 149*potent || (loser.active != potent && potent != 3))
  269.                 {
  270.                 sprint (printo,"Spell had no effect!\n");
  271.                 remove(self);
  272.                 return;
  273.                 }
  274.         MagicEffect(loser);
  275.         printnum = ftos(150*potent - loser.health);
  276.         if (loser.classname == "player")
  277.                 {
  278.                 other.speed=other.skin;
  279.                 other.skin=24;
  280.                 loser.pausetime = time + 150*potent - loser.health;
  281.                 loser.attack_finished = time + 150*potent - loser.health;
  282.                 loser.alivetime = time + 150*potent - loser.health;
  283.                 sprint (loser,"You have been held for ");
  284.                 sprint(loser,printnum);
  285.                 sprint (loser," seconds!\n");
  286.                 sprint (printo,loser.netname);
  287.                 }
  288.         else
  289.                 {
  290.                 loser.skin = 1;
  291.                 loser.nextthink = time + 150*potent - loser.health;
  292.                 sprint (printo,loser.classname);
  293.                 }
  294.         if(loser.flags&FL_FLY)
  295.                 loser.flags = loser.flags - FL_FLY;
  296.         if (loser.flags & FL_SWIM)
  297.                 loser.flags = loser.flags - FL_SWIM;
  298.         if(loser.flags&FL_ONGROUND)
  299.                 loser.flags = loser.flags - FL_ONGROUND;
  300.         sprint (printo," has been held for ");
  301.         sprint(printo,printnum);
  302.         sprint (printo," seconds!\n");
  303.         return;
  304. };
  305.  
  306. void (entity loser,float potent,entity printo) Charm =
  307. {
  308.         if (loser.active == -1)
  309.                 return;
  310.  
  311.         if (loser.active != potent && potent != 3)
  312.                 {
  313.                 sprint (printo,"Spell had no effect!\n");
  314.                 remove(self);
  315.                 return;
  316.                 }
  317.  
  318.         MagicEffect(loser);
  319.         loser.charmed = TRUE;
  320.         loser.controller = printo;
  321.         loser.spawnflags = 0;
  322.         loser.oldenemy = printo;
  323.         if (printo.enemy != world && printo.enemy.alive)
  324.                 loser.enemy = printo.enemy;
  325.         else loser.enemy = world;
  326.         loser.follow = FALSE;
  327.         printo.charmed = printo.charmed + 1;
  328.         sprint (printo,loser.classname);
  329.         sprint (printo," has been charmed by ");
  330.         sprint (printo,loser.controller.netname);
  331.         sprint (printo,"!\n");
  332.         return;
  333. };
  334.  
  335. void (entity loser, entity winner) BounceBack =
  336. {
  337. local vector vtemp,dir;
  338. local float dist;
  339.         MagicEffect(winner);
  340.         vtemp = loser.origin + '0 0 10';
  341.         dir = normalize(vtemp - winner.origin);
  342.         if (self.classname == "spike")
  343.                 launch_spike(winner.origin,dir,winner,"spike",0);
  344.         else if (self.classname == "superspike")
  345.                 launch_spike(winner.origin,dir,winner,"superspike",0);
  346.         else if (self.classname == "shrapnel")
  347.                 launch_spike(winner.origin,dir,winner,"shrapnel",0);
  348.         else if (self.classname == "rocket")
  349.                 W_FireRocket2(dir,winner,"rocket");
  350.         else if (self.classname == "knightspike")
  351.                 launch_spike (winner.origin, dir,winner,"knightspike",0);
  352.         else if (self.classname == "wizspike")
  353.                 {
  354.                 launch_spike (winner.origin, dir, winner,"wizspike",0);
  355.                 newmis.velocity = dir*600;
  356.                 newmis.owner = winner;
  357.         newmis.classname = "wizspike";
  358.         setmodel (newmis, "progs/w_spike.mdl");
  359.         setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);        
  360.                 }
  361.         else if (self.classname == "shalmissile")
  362.                 {
  363.                 dist = vlen (loser.origin - winner.origin);
  364.                 ShalMissile2(dir,dist,winner,loser);
  365.                 }
  366.         else if (self.classname == "homerocket")
  367.                 W_FireRocket2(dir,winner,"homerocket");
  368.         else if (self.classname == "homespread")
  369.                 W_FireSpread2(dir,winner,"homespread");
  370.         else if (self.classname == "spreadrocket")
  371.                 W_FireSpread2(dir,winner,"spreadrocket");
  372.         else if (self.classname == "laser")
  373.                 PLaser(dir,winner); 
  374.         remove(self);
  375. };
  376.  
  377. void (entity loser, entity winner, float oldsp) GrenBounceBack =
  378. {
  379.         local vector dir;
  380.  
  381.                 MagicEffect(winner);
  382.                 self.owner = winner;
  383.                 self.enemy = loser;
  384.                 dir = normalize(loser.origin + '0 0 10' - winner.origin);
  385.                 self.velocity = '0 0 0' * 0;
  386.                 self.velocity = dir * oldsp;
  387.                 self.velocity_x = self.velocity_x + (random () * 150 - 75);
  388.                 self.velocity_y = self.velocity_y + (random () * 150 - 75);
  389.                 self.velocity_z = self.velocity_z + (random () * 150);
  390.         self.angles = vectoangles(self.velocity);
  391. };
  392.  
  393. void () Zap =
  394. {
  395.                 if(self.owner.health<=0)
  396.                         remove(self);
  397.                 self.origin == self.enemy.origin + '0 0 0';
  398.                 if (self.enemy.health <= 0 || (!self.enemy.alive))
  399.                         {
  400.                                 self.origin = self.owner.origin;
  401.                                 if (self.owner.enemy.health > 0)  self.enemy = self.owner.enemy;
  402.                         }
  403.                 if (self.enemy.health > 0 && self.enemy != self.owner)
  404.                 {
  405.                         CastLightning();
  406.                         sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
  407.                 }
  408.                 else if (FindTarget())
  409.                 {
  410.                      CastLightning();
  411.                      sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
  412.                 }
  413.                 if (self.alivetime < time || self.mass > 1000)
  414.                         remove(self);
  415.                 self.think = Zap;
  416.                 self.nextthink = time + (random()*1);
  417. };
  418.  
  419. void () cast_touch =
  420. {
  421. local string removeme;
  422. local vector dir;
  423. local entity summoned;
  424.         if (other == self.owner)
  425.         return;        // don't explode on owner
  426.  
  427.     if (pointcontents(self.origin) == CONTENT_SKY)
  428.     {
  429.         remove(self);
  430.         return;
  431.     }
  432.  
  433.         if (other.active == -1)
  434.                 {
  435.                 sprint(self.owner,"Magic does not effect this monster!\n");
  436.                 return;
  437.                 }
  438.         if (other.prottime > time)
  439.                 {
  440.                 spawn_tfog (other.origin);
  441.                 sound(other,CHAN_AUTO,"enforcer/enfstop",1,ATTN_NORM);
  442.                 sprint(self.owner,other.netname);
  443.                 sprint(self.owner," is protected from magic");
  444.                 return;
  445.                 }
  446.         if (other.alive || self.aflag == 33||self.spell==88)
  447.         {
  448.         if (self.spell == 40)
  449.             HoldWeak(other,1,self.owner);
  450.         else if (self.spell == 60)
  451.             HoldWeak(other,2,self.owner);
  452.         else if (self.spell == 140)
  453.             HoldWeak(other,3,self.owner);
  454.         else if (self.spell == 80)
  455.         {
  456.                 MagicEffect(other);
  457.                 other.reflecttime = time + 60;                        
  458.                 sprint (self.owner,other.classname);
  459.                 sprint (self.owner," is protected by a Reflect Shield for 1 minute!\n");
  460.         }
  461.         else if (self.spell == 56)
  462.             Charm(other,1,self.owner);
  463.         else if (self.spell == 116)
  464.             Charm(other,2,self.owner);
  465.         else if (self.spell == 160)
  466.             Charm(other,3,self.owner);
  467.         else if (self.spell == 112)
  468.         {
  469.                 if(other.reflecttime>time)
  470.                         other=self.owner;
  471.                 if(other.classname!="player")
  472.                 {
  473.                         MagicEffect(other);
  474.                         summoned = spawn();
  475.                         setorigin(summoned, other.origin);
  476.                         summoned.angles = other.angles;
  477.                         remove(other);
  478.                         summoned.think = monster_dog;
  479.                         summoned.nextthink = time;
  480.                 }
  481.                 else
  482.                 {
  483.                         MagicEffect(other);
  484.                         other.health = 25;
  485.                         other.modelindex = modelindex_dog;
  486.                         other.dog_time = 1;
  487.                         other.dog_finished = time + 120;
  488.                         other.weaponmodel = "";
  489.                         DogChange(other);
  490.                         other.view_ofs = '0 0 4';
  491.                 }
  492.                 sound (other, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM);
  493.         }
  494.         else if (self.spell == 120)
  495.             {
  496.             MagicEffect(other);
  497.             other.mass = other.mass + 1;
  498.             if(other.flags&FL_FLY)
  499.                     other.flags = other.flags - FL_FLY;
  500.             if(other.flags&FL_SWIM)
  501.                     other.flags = other.flags - FL_SWIM;
  502.             sprint(self.owner,other.netname);
  503.             sprint(self.owner,"'s mass has been increased");
  504.             sprint(self.owner,"\n");
  505.             }
  506.         else if (self.spell == 156)
  507.         {
  508.             MagicEffect(other);
  509.             other.silencetime = time + 60;
  510.             if (other.classname == "player")
  511.                 bprint(other.netname);
  512.             else bprint(other.classname);
  513.             bprint(" has been silenced for 1 minute\n");
  514.         }
  515.         else if (self.spell == 180)
  516.         {
  517.             self.touch = FireTouch;
  518.             self.active = 5;
  519.             sound(other,CHAN_WEAPON,"weapons/r_exp3.wav",1,ATTN_NORM);
  520.             T_RadiusDamage (self, self.owner, 10, world);
  521.             WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  522.             WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  523.             WriteCoord (MSG_BROADCAST, other.origin_x);
  524.             WriteCoord (MSG_BROADCAST, other.origin_y);
  525.             WriteCoord (MSG_BROADCAST, other.origin_z);
  526.             other.velocity_z = other.velocity_z + 1000;
  527.             other.velocity_x = other.velocity_x + self.velocity_x*2;
  528.             other.velocity_y = other.velocity_y + self.velocity_y*2;
  529.             other.angles_x = random()*600;
  530.             other.angles_y = random()*600;
  531.             other.angles_z = random()*600;
  532.             other.flags = other.flags - (other.flags & FL_ONGROUND);
  533.             removeme = "NO";
  534.             FireTouch();
  535.         }
  536.         else if (self.spell == 100 || self.spell == 96)
  537.                 {
  538.                 MagicEffect(other);
  539.                 if (self.spell == 96)
  540.                         other.velocity = other.velocity + self.velocity*2 + '0 0 100';
  541.                 else
  542.                         other.velocity = other.velocity - self.velocity*2 + '0 0 100';
  543.                 other.flags = other.flags - FL_ONGROUND;
  544.                 T_Damage (self.enemy, self, self.owner, 10);
  545.                 }
  546.         else if (self.spell == 200 || self.aflag == 33)
  547.                 {
  548.                 self.solid = SOLID_NOT;
  549.                 self.movetype = MOVETYPE_NOCLIP;
  550.                 if (self.aflag != 33)
  551.                         MagicEffect(other);
  552.                 self.aflag = 33;
  553.                 self.velocity = '0 0 0';
  554.                 self.enemy = other;
  555.                 self.alivetime = time + 180;
  556.                 self.follow = FALSE;
  557.                 self.charmed = TRUE;
  558.                 self.controller = self.owner;
  559.                 Zap();
  560.                 removeme = "NO";
  561.                 }
  562.         else if (self.spell == 76)
  563.         {
  564.         MagicEffect(other);
  565.         if (((other.health >= self.owner.health && other.bloodloss < 1) || self.owner.health < 11) || other.classname == "player")
  566.                 {
  567.                 sprint(self.owner,"Spell had no effect\n");
  568.                 removeme=ftos(other.health);
  569.                 sprint(self.owner,other.classname);
  570.                 sprint(self.owner,"'s health (");
  571.                 sprint(self.owner,removeme);
  572.                 sprint(self.owner,") is higher than yours\n");
  573.                 remove(self);
  574.                 return;
  575.                 }
  576.         if(self.owner.health>other.health)
  577.                 other.health = self.owner.health;
  578.         self.owner.health = self.owner.health - 10;
  579.         other.bloodloss = 0;
  580.         sprint(self.owner,other.classname);
  581.         sprint(self.owner," has been healed\n");
  582.         }
  583.         else if (self.spell == 136)
  584.         {
  585.         MagicEffect(other);
  586.         if(other.classname != "player")
  587.                 {
  588.                 sprint(self.owner,"Spell had no effect...\n");
  589.                 return;
  590.                 }
  591.         sprint(other,"You're a fish out of water!\n");
  592.         other.suff = 1;
  593.         }
  594.         else if (self.spell == 176)
  595.         {
  596.         MagicEffect(other);
  597.         if(other.classname != "player")
  598.                 {
  599.                 sprint(self.owner,"Spell had no effect...\n");
  600.                 return;
  601.                 }
  602.         other.suff = 2;
  603.         other.air_finished = time;
  604.         }
  605.         if (removeme != "NO") remove(self);
  606.         }
  607.         else
  608.         {
  609.         remove(self);
  610.         return;
  611.         }
  612.         MagicEffect(self);
  613.         return;
  614. };
  615.  
  616. float() SummonScrag2 =
  617. {
  618. local entity summoned;
  619.         if (self.charmed >= 10)
  620.                 {
  621.                 sprint(self,"You can't spawn a second scrag\n");
  622.                 return 1;
  623.                 }
  624.                 summoned = spawn();
  625.                 summoned.charmed = TRUE;
  626.                 summoned.controller = self;
  627.                 summoned.oldenemy = self.owner;
  628.                 if (self.enemy != world && self.enemy.alive)
  629.                         summoned.enemy = self.enemy;
  630.                 else summoned.enemy = world;
  631.                 self.charmed = self.charmed + 1;
  632.                 summoned.follow = FALSE;
  633.                 summoned.think = monster_wizard;
  634.                 setorigin(summoned, self.origin + v_forward*48 + '0 0 16');
  635.                 MagicEffect(summoned);
  636.                 summoned.nextthink = time;
  637.                 return 2;
  638. };
  639. void()Radiate=
  640. {
  641.                 T_RadiusDamage(self,self,120,world);
  642.                 if(self.alivetime < time)
  643.                         {
  644.                         MagicEffect(self);
  645.                         remove(self);
  646.                         }
  647.                 self.think = Radiate;
  648.                 self.nextthink = time + 0.2;
  649. };
  650.  
  651. void()MassEffect=
  652. {
  653. local entity summoned;
  654. local float hp,sum;
  655.                 hp = self.owner.mana*10;
  656.                 summoned = findradius (self.owner.origin, 1000);
  657.                 if (hp <= summoned.health)
  658.                 {
  659.                         if(self.owner.spell==188)
  660.                                 T_Damage(summoned,self.owner,self.owner,summoned.health+summoned.health/2);
  661.                 }
  662.                 else while(summoned)
  663.                 {
  664.                     if(summoned.controller != self.owner && summoned.alive && summoned != self.owner)
  665.                     {
  666.                         traceline (self.owner.origin, summoned.origin, FALSE, self.owner);
  667.                         if (trace_ent.alive)
  668.                         {
  669.                                 hp = hp - summoned.health;
  670.                                 sum = sum + summoned.health/10;
  671.                                 if (hp < 0)
  672.                                 {
  673.                                 if(self.owner.spell==188)
  674.                                         T_Damage(summoned,self.owner,self.owner,hp+summoned.health);
  675.                                 else if(self.owner.spell==192)
  676.                                         Charm(summoned,3,self.owner);
  677.                                 else if(self.owner.spell==168)
  678.                                         HoldWeak(summoned,3,self.owner);
  679.                                 hp = 0;
  680.                                 break;
  681.                                 }
  682.                                 else
  683.                                 {
  684.                                 MagicEffect(summoned);
  685.                                 if(self.owner.spell==188)
  686.                                         T_Damage(summoned,self.owner,self.owner,summoned.health + random()*81 + 50);
  687.                                 else if(self.owner.spell==192)
  688.                                         Charm(summoned,3,self.owner);
  689.                                 else if(self.owner.spell==168)
  690.                                         HoldWeak(summoned,3,self.owner);
  691.                                 }
  692.                         }
  693.                     }
  694.                     summoned = summoned.chain;
  695.                 }
  696.                 self.mana = rint(time - self.init_mana);
  697.                 if (self.mana > self.exp/1000)
  698.                         self.mana = self.exp/1000;
  699.                 self.init_mana = time - self.mana + sum;
  700.                 remove(self);
  701. };
  702.         
  703. void() SelfCast =
  704. {
  705. local entity summoned;
  706. local float hp;
  707. local string summsg;
  708. local vector dir;
  709.         self.alivetime = time + self.spell/20;
  710.         if (self.spell == 164 || self.spell == 148 || self.spell == 184 || self.spell == 108 || self.spell == 48)
  711.             {
  712.             if (self.charmed >= 10&&self.spell!=112)
  713.                 {
  714.                         sprint(self,"You can't control more than ten monsters at a time\n");
  715.                         return;
  716.                 }
  717.                 summoned = spawn();
  718.                 summoned.charmed = TRUE;
  719.                 summoned.controller = self;
  720.                 summoned.oldenemy = self.owner;
  721.                 summoned.enemy = world;
  722.                 summoned.follow = FALSE;
  723.                 self.charmed = self.charmed + 1;
  724.                 setorigin(summoned, self.origin + v_forward*128 + '0 0 16');
  725.                 summoned.angles = self.angles;
  726.         if (pointcontents(summoned.origin) == CONTENT_SOLID)
  727.                 {
  728.                 sprint(self,"Find a more open area\n");
  729.                 summoned.think = SUB_Remove;
  730.                 summoned.nextthink = time;
  731.                 self.alivetime = time;
  732.                 return;
  733.                 }
  734.         if (self.spell == 164)
  735.                 {
  736.                 hp = 400;
  737.                 summsg = "Vore Summoned by ";
  738.                 summoned.think = monster_shalrath;
  739.                 }
  740.         else if (self.spell == 148)
  741.                 {
  742.                 hp = 300;
  743.                 summsg = "Fiend Summoned by ";
  744.                 summoned.think = monster_demon1;
  745.                 }
  746.         else if (self.spell == 108)
  747.                 {
  748.                 hp = 200;
  749.                 summsg = "Ogre Summoned by ";
  750.                 summoned.think = monster_ogre;
  751.                 }
  752.         else if (self.spell == 48)
  753.                 {
  754.                 summsg = "Scrags Summoned by ";
  755.                 summoned.think = monster_wizard;
  756.                 hp = 80 * SummonScrag2();
  757.                 }
  758.         else if (self.spell == 184)
  759.                 {
  760.                 hp = 600;
  761.                 summsg = "Shambler Summoned by ";
  762.                 summoned.think = monster_shambler;
  763.                 }
  764.         if (self.mana < hp)
  765.                 {
  766.                 sprint(self,"Not enough mana\n");
  767.                 return;
  768.                 }
  769.         sprint(self,summsg);
  770.         sprint (self,summoned.controller.netname);
  771.         sprint (self,"!\n");
  772.         self.mana = rint(time - self.init_mana);
  773.         if (self.mana > self.exp/1000)
  774.                 self.mana = self.exp/1000;
  775.         self.init_mana = time - self.mana + hp;
  776.         MagicEffect(summoned);
  777.         summoned.nextthink = time;
  778.         }
  779.         else
  780.         {
  781.         self.mana = rint(time - self.init_mana);
  782.         if (self.mana > self.exp/1000)
  783.                 self.mana = self.exp/1000;
  784.         self.init_mana = time - self.mana + self.spell;
  785.         if (self.spell == 188 || self.spell == 168 || self.spell == 192)
  786.         {
  787.                 summoned = spawn();
  788.                 summoned.owner = self;
  789.                 setorigin(summoned,self.origin);
  790.                 if (self.spell == 188)        
  791.                         {
  792.                         sound(self,CHAN_AUTO,"weapons/moadib.wav",1,ATTN_NORM);
  793.                         hp = 1;
  794.                         }
  795.                 summoned.think = MassEffect;
  796.                 summoned.nextthink = time + hp;
  797.         }
  798.         else if(self.spell == 152)
  799.         {
  800.                 summoned = spawn();
  801.                 summoned.owner = self;
  802.                 summoned.alivetime = time + 120;
  803.                 setorigin(summoned,self.origin);
  804.                 MagicEffect(summoned);
  805.                 sprint(self,"Death Barrier in place for 2 minutes\n");
  806.                 summoned.think = Radiate;
  807.                 summoned.nextthink = time + 1;
  808.         }
  809.         else
  810.         {
  811.         MagicEffect(self);
  812.         if (self.spell == 144)
  813.                 TeleEyes();
  814.         else if (self.spell == 72)
  815.                 CheckHoloCommand();
  816.         else if (self.spell == 172)
  817.                 self.archtime = time + 30;
  818.         else if (self.spell == 24)
  819.         {
  820.         if(self.bloodloss>0)
  821.                 {
  822.                 self.bloodloss = 0;
  823.                 sprint(self,"Wounds healed\n");
  824.                 }
  825.         if(self.health<50)
  826.                 {
  827.                 self.health = self.health + 20 + rint(random()*10);
  828.                 if (self.health > 50)
  829.                         self.health = 50;
  830.                 }
  831.         }
  832.         else if (self.spell == 64)
  833.         {
  834.         if(self.bloodloss>0)
  835.                 {
  836.                 self.bloodloss = 0;
  837.                 sprint(self,"Wounds healed\n");
  838.                 }
  839.         if(self.health<100)
  840.                 {
  841.                 self.health = self.health + 40 + rint(random()*20);
  842.                 if (self.health > 100)
  843.                        self.health = 100;
  844.                 }
  845.         }
  846.         else if (self.spell == 28)
  847.         {
  848.         self.armorvalue = self.armorvalue + 80 + rint(random()*40);
  849.         if (self.armorvalue > 200)
  850.                 self.armorvalue = 200;
  851.         }
  852.         else if (self.spell == 124)
  853.         {
  854.         if(self.bloodloss>0)
  855.                 {
  856.                 self.bloodloss = 0;
  857.                 sprint(self,"Wounds healed\n");
  858.                 }
  859.         if(self.health<200)
  860.                 {
  861.                 self.health = self.health + 80 + rint(random()*40);
  862.                 if (self.health > 200)
  863.                         self.health = 200;
  864.                 }
  865.         }
  866.         else if (self.spell == 52)
  867.         {
  868.         self.protmisstime = time + 60;                        
  869.         sprint (self,self.netname);
  870.         sprint (self," is protected against explosions for 1 minute!\n");
  871.         }
  872.         else if (self.spell == 128)
  873.         {
  874.         self.reflecttime = time + 60;                        
  875.         sprint (self,self.netname);
  876.         sprint (self," is protected by a Reflect Shield for 1 minute!\n");
  877.         }
  878.         else if (self.spell == 84)
  879.                 {
  880.                 self.items = self.items | IT_INVISIBILITY;
  881.                 self.invisible_time = 1;
  882.                 self.invisible_finished = time + 90;
  883.                 }
  884.         else if (self.spell == 92)
  885.                 {
  886.                 self.items = self.items | IT_QUAD;
  887.                 self.super_time = 1;
  888.                 self.super_damage_finished = time + 30;
  889.                 }
  890.         else if (self.spell == 32)
  891.                 {
  892.                 self.firesistime = time + 90;
  893.                 sprint(self,self.netname);
  894.                 sprint(self," is protected against fire for 90 seconds\n");
  895.                 }
  896.         else if (self.spell == 68)
  897.                 {
  898. //                self.movetype=MOVETYPE_FLY;//so-so, not as good as flymode
  899.                 self.levitime = time + 90;
  900.                 }
  901.         else if (self.spell == 44)
  902.                 {
  903.                 self.reflecttime = time;
  904.                 self.protmisstime = time;
  905.                 self.mass = 1;
  906.                 self.pausetime = 0;
  907.                 self.levitime = time;
  908.                 if (self.suff > 0)
  909.                        {
  910.                        self.air_finished = time + 12;
  911.                        self.suff = 0;
  912.                        sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  913.                        }
  914.                 if (self.invincible_time > time)
  915.                 {
  916.                         self.items = self.items - IT_INVULNERABILITY;
  917.                         self.invincible_time = 0;
  918.                         self.invincible_finished = 0;
  919.                 }
  920.                 sprint(self,self.netname);
  921.                 sprint(self," is cleansed of all magic\n");
  922.                 }
  923.         else if (self.spell == 132)
  924.                 {
  925.                 self.prottime = time + 60;
  926.                 sprint(self,self.netname);
  927.                 sprint(self," is protected from magic for 1 minute\n");
  928.                 }
  929.         else if(self.spell == 104)
  930.         {
  931.                 self.air_finished = time + 600; // 10 minutes breathe under water
  932.                 self.dmg = 2;
  933.                 sprint(self,self.netname);
  934.                 sprint(self," can breathe under water for 10 minutes\n");
  935.         }
  936.         }
  937.         }
  938. };
  939. /*---------------------------------------------
  940. TeleEyes
  941. ---------------------------------------------*/
  942.  
  943. void (entity me) TeleEyesWarp =
  944. {
  945.  local vector    org;
  946.  
  947.         if (me.aflag == 666)
  948.                 HoloCam(me);
  949.  
  950.         me.teleeyes.solid = SOLID_NOT;
  951.         me.teleeyes.takedamage = DAMAGE_NO;
  952.         spawn_tfog (me.origin);
  953.  
  954. // spawn a tfog flash in front of the destination
  955.  
  956.         makevectors (me.teleeyes.mangle);
  957.         org = me.teleeyes.origin;
  958.  
  959.     spawn_tfog (org);
  960.         spawn_tdeath(me.teleeyes.origin, me);
  961.  
  962.     
  963. // move the player and lock him down for a little while
  964.  
  965. //        if (!me.health)
  966. //        {
  967. //                me.velocity=(v_forward*me.velocity_x)+(v_forward*me.velocity_y);
  968. //                me.oldorigin=me.teleeyes.origin;
  969. //                setorigin (me, me.teleeyes.origin);
  970. //                return;
  971. //        }
  972.  
  973.         setorigin (me, me.teleeyes.origin);
  974.         me.angles = me.teleeyes.mangle;
  975.  
  976.         me.teleport_time = time + 0.7;
  977.         if (me.flags & FL_ONGROUND)
  978.                 me.flags = me.flags - FL_ONGROUND;
  979.         me.flags = me.flags - me.flags & FL_ONGROUND;
  980.         return;
  981. };
  982.  
  983. void () TeleEyesDie =
  984. {
  985.         self.owner.isfeign = FALSE;
  986.         TeleEyesWarp(self.owner);
  987.         T_Damage (self.owner, self.enemy, self.enemy, self.owner.health + 100);
  988.         self.active = FALSE;
  989.         remove (self);
  990. };
  991.  
  992. void(entity myself) ActivateEyes =
  993. {
  994. local entity tel;
  995.         tel = spawn();
  996.         tel.solid = SOLID_BBOX;
  997.         tel.takedamage = DAMAGE_AIM;
  998.         tel.health = 1;
  999.         tel.movetype = MOVETYPE_NOCLIP;
  1000.         tel.origin = myself.origin;
  1001.         tel.angles = myself.angles;
  1002.         setsize (tel, '-3 -3 50', '3 3 53');
  1003.         setmodel (tel, "progs/eyes.mdl");
  1004.         tel.classname = "TeleEye";
  1005.         tel.owner=myself;
  1006.         myself.teleeyes = tel;
  1007.         stuffcmd (tel.owner, "bf\n");
  1008.         sprint(tel.owner,"TeleEyes Placed\n");
  1009.         sound (myself, CHAN_WEAPON, "weapons/teleeyes.wav",1, ATTN_NORM);
  1010.         tel.nextthink = time;
  1011.         tel.think = SUB_Null;
  1012.         tel.active = TRUE;
  1013.         tel.th_stand = SUB_Null;
  1014.         tel.th_walk = SUB_Null;
  1015.         tel.th_run = SUB_Null;
  1016.         tel.th_pain = SUB_Null;
  1017.         tel.th_melee = SUB_Null;
  1018.         tel.th_missile = SUB_Null;
  1019.         tel.th_die = TeleEyesDie;
  1020.         tel.beendead = TRUE;
  1021. };
  1022.  
  1023. void () TeleEyes =
  1024. {
  1025.         if (self.newholo.active)
  1026.         {
  1027.                 sound (self, CHAN_WEAPON, "doors/basetry.wav", 1 , ATTN_NORM);
  1028.                 sprint(self,"Deactivate or Detonate Holograph first...\n");
  1029.         return;
  1030.     }
  1031.         if (self.mana < 10)
  1032.     {
  1033.                 sound (self, CHAN_WEAPON, "doors/basetry.wav", 1 , ATTN_NORM);
  1034.                 sprint(self,"Mana is too low!\n");
  1035.         return;
  1036.     }
  1037.         if (self.teleeyes.active == FALSE)
  1038.                 {
  1039.                 ActivateEyes (self);
  1040.                 return;
  1041.                 }
  1042.         TeleEyesWarp(self);
  1043.         remove(self.teleeyes);
  1044.         self.teleeyes.active = FALSE;
  1045.         return;
  1046. };
  1047.